package com.happly.happlycloud.dao;

import com.happly.happlycloud.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    int checkUsername(String username);

    int checkEmail(String email);

    User selectLogin(@Param("username") String username, @Param("password")String password);

    String selectQuestionByUsername(String username);

    int checkAnswer(@Param("username")String username,@Param("question")String question,@Param("answer")String answer);

    int updatePasswordByUsername(@Param("username")String username,@Param("passwordNew")String passwordNew);

    int checkPassword(@Param(value="password")String password,@Param("userId")Integer userId);

    int checkEmailByUserId(@Param(value="email")String email,@Param(value="userId")Integer userId);

    List<User> selectByNameAndUserId(@Param("userName")String userName,@Param("userId") Integer userId,@Param("email") String email,@Param("phone") String phone);

    List<User> selectList();

    int ChangeSetRole(@Param("userId")Integer userId,@Param("role") Integer role);

    int froseSetRole(@Param("userId")Integer userId);

    int unfroseSetRole(@Param("userId")Integer userId);

    List<Integer> findAllUser();

    Integer getUserCount();

    Integer getProductCount();

    Integer getOrderCount();

    Integer getMessageCount();

    Integer getProductTutorCount(Integer id);

    Integer getOrderTutorCount(Integer id);

    Integer getMessageTutorCount(Integer id);

    int selectByUsername(@Param("userName")String userName);

    User selectByName(Integer id);
}